package com.controller;

import com.service.orderService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class receiveServlet extends HttpServlet {
    private orderService orderService=new orderService();
    /**
     * 确认收货
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=UTF-8");
        String orderid = req.getParameter("od");
        String userid = req.getParameter("us");
        if(userid==null||userid.equals("")){
            return;
        }

        if(userid!=null && orderid!=null){
            int uid = Integer.parseInt(userid);
            orderService.receiveSuccess(uid,orderid);
            resp.sendRedirect("showUserOrderInfoServlet");
        }
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
